using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class DeckReader : MonoBehaviour
{
    public List<GameObject> cards;
    public Transform charaParent;
    // Start is called before the first frame update
    void Start()
    {
        if(cards.Count != 14)
        {
            Debug.Log("Cards Number Error!");
        }
        for(int i = 0; i < cards.Count; i++)
        {
            if (cards[i] == null)
                continue;
            Pawn pawn = Instantiate(cards[i], charaParent).GetComponent<Pawn>();
            GridManager.instance.grids[i].Pawn = pawn;
            // GridManager.instance.grids[i].GetComponent<CardPosition>().SetPawn(pawn);
            pawn.gridNode = GridManager.instance.grids[i];
            pawn.GetComponent<PawnAnchor>().AnchorPosition
                = GridManager.instance.grids[i].GetComponent<CardPosition>();
            pawn.transform.position = pawn.gridNode.transform.position;
            if(i <= 6)
            {
                pawn.campIsSelf = true;
                //pawn.transform.localScale = new Vector3(-1f, 1f, 1f);
                //pawn.HealthBarImage.color = new Color(0f, 1f, 0f);
            }
        }
    }

    // Update is called once per frame
    void Update()
    {
        
    }
}
